/**
 * Created by ZMoffice on 2017-06-12.
 */
var aaa = 5;
var BASEAPI = "http://112.74.168.200/helipay/";
function gg() {
    var managementuser = document.getElementById('managementuser').value;
    var managementuserpwd = document.getElementById('managementuserpwd').value;
    var aa = hex_md5(managementuserpwd);
    console.log(typeof(aa));
    console.log(typeof(managementuser));
    var param = {
        customerNumber: managementuser,
        loginPassword: aa
    }
    if(managementuser == '') {
        alert("账号不能为空!")
    } else if(managementuserpwd == '') {
        alert("密码不能为空!")
    } else {
        $.ajax({
            url: BASEAPI+'login',
            type: 'POST',
            data: param,
            dataType: 'json',
            success: function(data) {
                if(data.errorCode == '0000') {
                    //								alert("成功提交！");
                    //							console.log(data.result.session);
                    console.log(data);
                    sessionStorage.setItem("session", data.result.session);
                    sessionStorage.setItem("managementuser", data.result.customerName);
                    sessionStorage.setItem("managementuserA", data.result.customerNumber);
                    window.location.href = 'main';
                } else if(data.errorCode == '1011') {
                    alert(data.errorMessage);
                } else {
                    alert("账号不存在或密码错误！");

                }

            },
            error: function(err) {
                console.log(err);
                alert("连接服务器失败！请重新提交！")
            }
        });
    }
}